CC= gcc
CFLAGS= -Wall -W -g -pthread
HEAD= $(wildcard *.h)
SRC= $(wildcard *.c)

.PHONY: default all test check avance

default: example

all: example test check avance

test: test_list fibonacci tri ptri curve

check: stable

avance: preemption mutex


tri: tri.o list.o thread.o
	$(CC) $(CFLAGS) $^ -o $@

ptri: ptri.o
	$(CC) $(CFLAGS) $^ -o $@

curve: curve.o
	$(CC) $(CFLAGS) $^ -o $@

fibonacci: fibonacci.o list.o thread.o
	$(CC) $(CFLAGS) $^ -o $@

example: example.o list.o thread.o
	$(CC) $(CFLAGS) $^ -o $@

stable: stable.o list.o thread.o
	$(CC) $(CFLAGS) $^ -o $@

preemption: preemption.o list.o thread.o
	$(CC) $(CFLAGS) $^ -o $@

mutex: mutex.o list.o thread.o
	$(CC) $(CFLAGS) $^ -o $@

test_list: test_list.o list.o
	$(CC) $(CFLAGS) $^ -o $@

%.o: %.c %.h
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f a.out
	rm -f *~
	rm -f *.o

cleanall: clean
	rm -f example
	rm -f stable
	rm -f test_list
	rm -f fibonacci
	rm -f preemption
	rm -f ptri
	rm -f tri
	rm -f curve
	rm -f mutex